import moment from "moment";

export const branchOptions = [
    {
        label: '天津分公司',
        value: '1'
    }, {
        label: '北京分公司',
        value: '2'
    }
];

export const jobTypeOptions = [
    {
        label: '无',
        value: '0'
    },
    {
        label: '专职',
        value: '1'
    }, {
        label: '兼职',
        value: '2'
    }
]

export const ageOptions = [
    {
        label: '大于65',
        value: 65
    }, {
        label: '大于63',
        value: 63
    }
]

export const leadTypeOptions = [
    {
        label: '组长',
        value: 1
    },
    {
        label: '见习组长',
        value: 2
    }, {
        label: '否',
        value: 0
    }
]

export const structureOptions = [
    {
        label: 'QMS',
        value: 0
    },
    {
        label: 'EMS',
        value: 1
    }, {
        label: 'OHSMS',
        value: 2
    }
]


export const qualificationOptions = [
    {
        label: '审核员',
        value: 0
    },
    {
        label: '实习审核员',
        value: 1
    }, {
        label: '技术专家',
        value: 2
    }, {
        label: '审查员',
        value: 3
    }
]

export const qualificationExpirOptions = [
    {
        label: '前四个月',
        value: 4
    }
]

export const personnelLayerOptions = [
    {
        label: 'A',
        value: 'A'
    }, {
        label: 'B',
        value: 'B'
    }, {
        label: 'C',
        value: 'C'
    }, {
        label: 'D',
        value: 'D'
    }
]

export const monthTypeOptions = [
    {
        label: '1月份',
        value: '1'
    }, {
        label: '2月份',
        value: '2'
    }, {
        label: '3月份',
        value: '3'
    }, {
        label: '4月份',
        value: '4'
    }, {
        label: '5月份',
        value: '5'
    }, {
        label: '6月份',
        value: '6'
    }, {
        label: '7月份',
        value: '7'
    }, {
        label: '8月份',
        value: '8'
    }, {
        label: '9月份',
        value: '9'
    }, {
        label: '10月份',
        value: '10'
    }, {
        label: '11月份',
        value: '11'
    }, {
        label: '12月份',
        value: '12'
    }
]

export const suspensionOptions = [
    {
        label: '是',
        value: 1,
    }, {
        label: '否',
        value: 0
    }
]

export const QualificationStandard = [
    {
        label: 'QMS16GB',
        value: 1
    }
]

export const QualificationLeadType = [
    {
        key: 1,
        name: '组长',
        value: 1
    },
    {
        key: 2,
        name: '见习组长',
        value: 2
    }, {
        key: 0,
        name: '否',
        value: 0
    }
]

export const QualificationWitnessType = [
    {
        key: 1,
        name: '内部见证',
        value: 1
    }, {
        key: 0,
        name: '外部见证',
        value: 0
    }
]

/**
 * 获取枚举值的label
 * @param {*} value 
 * @param {*} options 
 */
export const getOptionLabel = (value, options, valueKey = 'value', labelKey = 'label') => {

    if (!value) {
        return null;
    }

    return options.find(item => item[valueKey] === value)?.[labelKey] || null;

}

export const getTimeValue = (value) => {
    if (!value) {
        return null;
    }

    const format = 'yyyy/MM/dd HH:mm:ss';

    return moment(value).format(format);
}
export const getCurrentTime = () => {
    return moment().format('yyyy-MM-DD HH:mm:ss');
}